<template>
  <div class="article-item-container">
    <!-- 单元格 -->
    <!-- @click="$router.push(`article/${ArticleItem.art_id}`)" -->
    <van-cell-group
      inset
      @click="$router.push({ name: 'article', params: { articleId: ArticleItem.art_id } })"
    >
      <van-cell>
        <!-- 标题 -->
        <div slot="title">
          <div class="title van-multi-ellipsis--l2">{{ ArticleItem.title }}</div>
          <!-- 三张图片 -->
          <div class="cover-wrap" v-if="ArticleItem.cover.type === 3">
            <div class="cover-item" v-for="(item, index) in ArticleItem.cover.images" :key="index">
              <van-image
                class="cover-item-img"
                fit="cover"
                :src="ArticleItem.cover.images[index]"
              />
            </div>
          </div>
          <!-- /三张图片 -->
        </div>
        <!-- 作者 评论 发布时间 -->
        <div slot="label" class="label-wrap">
          <span>作者：{{ ArticleItem.aut_name }}</span>
          <span>{{ ArticleItem.comm_count }}评论</span>
          <span>{{ ArticleItem.pubdate | relativeTime }}</span>
        </div>
        <!-- 一张图片 -->
        <van-image
          class="right-img"
          slot="default"
          v-if="ArticleItem.cover.type === 1"
          :src="ArticleItem.cover.images[0]"
        />
        <!-- /一张图片 -->
      </van-cell>
    </van-cell-group>
    <!-- /单元格 -->
  </div>
</template>

<script>
export default {
  name: 'ArticleItem',
  props: {
    // 频道列表对象
    ArticleItem: {
      type: Object,
      required: true
    }
  }
}
</script>

<style lang="less" scoped>
.article-item-container {
  .title {
    font-size: 32px;
    font-family: '微软雅黑';
    color: #3a3a3a;
  }
  .cover-wrap {
    display: flex;
    .cover-item {
      flex: 1;
      height: 146px;
      padding: 30px 0;
      &:nth-child(-n + 2) {
        padding-right: 4px;
      }
      .cover-item-img {
        width: 227px;
        height: 146px;
      }
    }
  }
  .label-wrap {
    span {
      font-size: 23px;
      padding-right: 25px;
    }
  }
  .van-cell {
    .van-cell__title {
    }
    .van-cell__value {
      flex: none;
    }
  }
  .right-img {
    width: 232px;
    height: 146px;
    padding-left: 20px;
  }
}
</style>
